<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>The Ajax 01 Page</h1>
    <fieldset>
        <legend>异步请求</legend>
        <button onclick="getAjaxRequest()">Get Request</button>
        <span id="result">Loading data...</span>
    </fieldset>
</div>
</body>
<script>
    function getAjaxRequest(){
        debugger;
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4&&xhr.status==200){
                document.getElementById("result").innerHTML=xhr.responseText;
            }
        };
        xhr.open("get","http://localhost:1314/doAjaxGet",true);
        xhr.send();
    }
</script>
</html>